<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>


<title>bookStore列表</title>
<%--导入css --%>
<link rel="stylesheet" href="css/main.css" type="text/css" />
</head>

<body class="main">

	<jsp:include page="head.jsp" />
	<jsp:include page="menu_search.jsp" />

	<div id="divpagecontent">
		<table width="100%" border="0" cellspacing="0">
			<tr>

				<td>
					<div style="text-align:right; margin:5px 10px 5px 0px">
						<a href="index.jsp">首页</a>&nbsp;&nbsp;&nbsp;&nbsp;&gt;&nbsp;&nbsp;&nbsp;&nbsp;${pageBean.type}&nbsp;&nbsp;&nbsp;&nbsp;&gt;&nbsp;&nbsp;&nbsp;&nbsp;图书列表
					</div>

					<table cellspacing="0" class="listcontent">
						<tr>
							<td>
								<h1>商品目录</h1>
								<hr />
								<h1>${pageBean.type}</h1>&nbsp;&nbsp;&nbsp;&nbsp;共${pageBean.totalCount}种商品
								<hr />
								<div style="margin-top:20px; margin-bottom:5px">
									<img src="images/productlist.gif" width="100%" height="38" />
								</div>
								<table cellspacing="1" class="booklist">
									<tr>
									<% int a=0; %>
									<c:forEach items="${pageBean.list}" var="s">
									
										<td>

											<div class="divbookpic">
												<p>
													<a href="FunctionServlet?id=2&panme=${s.pname}"><img src="bookcover/101.jpg" width="115"
														height="129" border="0" /> </a>
												</p>
											</div>
                                                <%a++;%>
											<div class="divlisttitle">
												<a href="product_info.jsp">书名:${s.pname}<br />售价:${s.price}</a>
											</div></td>
										<c:if test="<%=a%4==0%>">
										
										<tr>
										</c:if>
									  </c:forEach>
									</tr>
									
								</table>



								<div class="pagination">
									<ul>


										<c:if test="${pageBean.pageCode ne 1 }">
	                                        <li class="disablepage"><a href="FunctionServlet?id=1&pageCode=${pageBean.pageCode-1 }&type=${pageBean.category}">上一页&lt;&lt;</a></li>
                                        </c:if>
										<c:choose>
										
 	                                        <c:when test="${pageBean.totalPage le 3 }">
 		                                        <c:set var="begin" value="1"></c:set>
 		                                        <c:set var="end" value="${pageBean.totalPage }"></c:set>
 	                                        </c:when>
 	
 	                                        <c:otherwise>
 		                                        <c:set var="begin" value="${pageBean.pageCode-1 }"></c:set>
 		                                        <c:set var="end" value="${pageBean.pageCode+1 }"></c:set>
 		
 		                                        <c:if test="${begin < 1}">
 			                                        <c:set var="begin" value="1"></c:set>
 			
 			                                        <c:set var="end" value="${pageBean.pageCode+2 }"></c:set>
 		                                        </c:if>
 		
 		
 		                                        <c:if test="${end > pageBean.totalPage }">
 			                                        <c:set var="begin" value="${pageBean.totalPage-2 }"></c:set>
 			
 			                                        <c:set var="end" value="${pageBean.totalPage}"></c:set>
 		                                        </c:if>
 	                                        </c:otherwise>
                                         </c:choose>
 
 	                                        <c:forEach var="i" begin="${begin}" end="${end}" step="1">
 	
 	                                        <c:choose>
 	
 		                                        <c:when test="${i eq pageBean.pageCode }">
 			                                        ${i }
 		                                        </c:when>
 		
 		                                        <c:otherwise>
 			                                        <a href="FunctionServlet?id=1&pageCode=${i}&type=${pageBean.category}">${i}</a>
 		                                        </c:otherwise>
 	                                        </c:choose>
 		
 	                                        </c:forEach> 
 	                                        
                                        <c:if test="${pageBean.pageCode ne pageBean.totalPage or totalPage eq 0}">
                                        <li class="nextpage"><a href="FunctionServlet?id=1&pageCode=${pageBean.pageCode+1 }&type=${pageBean.category}">下一页&gt;&gt;</a></li>
                                        </c:if>
										
										

									</ul>
								</div>
							</td>
						</tr>
					</table></td>
			</tr>
		</table>
	</div>



	<jsp:include page="foot.jsp" />


</body>
</html>
